package cj.web.tb.dao;
/*
 *  
 *  
*/
import java.util.List;

import net.paoding.rose.jade.annotation.DAO;
import net.paoding.rose.jade.annotation.SQL;
import net.paoding.rose.jade.annotation.SQLParam;
import cj.web.tb.domain.ComposeOnlineOrder;

/**
 * 
 * @author 
 *
 */
@DAO
public interface ComposeOnlineOrderDAO{
	
    @SQL("SELECT * FROM ComposeOnlineOrder WHERE id=:1")
    ComposeOnlineOrder queryById(int id);
    
    //-----------
    @SQL("SELECT id,orderNo,userId,gameId,duration,price,parentName,parentPhone,name,identityCard,teacher,area,school,grade,status,payWay,payOrder,source,subjectId,isExam,composition,isCheck,teacherId,score,isWin,deleteFlag,createAt,createUser,updateAt,updateUser,remark FROM ComposeOnlineOrder WHERE deleteFlag=1 and teacherId=:t.teacherId #if(:t.gameId!=null){ and gameId=:t.gameId } #if(:t.grade!=null){ and grade like '%##(:t.grade)%' } #if(:t.isCheck!=null){ and isCheck=:t.isCheck } #if(:t.remark!=null){ and remark=:t.remark } ORDER BY createAt DESC LIMIT :t.start,:t.length ")
    List<ComposeOnlineOrder> queryCheck(@SQLParam("t") ComposeOnlineOrder composeOnlineOrder);
	
	@SQL("SELECT count(1) FROM ComposeOnlineOrder WHERE deleteFlag=1 and teacherId=:t.teacherId #if(:t.gameId!=null){ and gameId=:t.gameId } #if(:t.grade!=null){ and grade like '%##(:t.grade)%' } #if(:t.isCheck!=null){ and isCheck=:t.isCheck } #if(:t.remark!=null){ and remark=:t.remark } ")
	int queryChecksize(@SQLParam("t") ComposeOnlineOrder composeOnlineOrder);
	
	@SQL("UPDATE ComposeOnlineOrder SET isCheck=:t.isCheck,score=:t.score,remark=:t.remark,updateAt=now() WHERE id=:t.id")
    void updateCheckStatus(@SQLParam("t") ComposeOnlineOrder composeOnlineOrder);
}